﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using entidades;
using Servicos;
using Google.Api.Maps.Service.Geocoding;
using Google.Api.Maps.Service;

namespace ASPNETUI
{
    public partial class Default : System.Web.UI.Page
    {   
        private String Geocode;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void endereco_TextChanged(object sender, EventArgs e)
        {

        }

        protected void Button_Salvar(object sender, EventArgs e)
        {
            String endereçoformatado = endereco.Text + " - " + "Rio de Janeiro" + " - " + "RJ" + " - " + " Brasil";
            
            if (GerenciadorLocalizacao.ObterGeocode(endereçoformatado) != null)
            {
                //resultsTreeView.ItemsSource = response.Results.ToTree();
                Blitz Blitz = new Blitz(0, "teste", 0, "Rio de Janeiro", "Rio de Janeiro", DateTime.Now, 000000, GerenciadorLocalizacao.ObterGeocode(endereco.Text));
                BlitsServico BlitsServico = new BlitsServico();
                BlitsServico.create(Blitz);
            }                
            
        }
    }
}